<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@include file="/includes/taglibs.jsp"%>
<%@page import="com.feib.soeasy.util.UserUtil"%>
<%@page import="com.feib.soeasy.model.User"%>

<script type="text/javascript">

$(document).ready(function() {	
	$("#cancelEditGroupBtn").click(function() {
		$("#editCommissionCodeTableDiv").dialog("close");
	});

	//
	$("#doSaveGroupBtn").click(function() {
		var groupPk = $('#editGroup\\.groupPk').val();
		var postLevel1 = $('#editGroup\\.postLevel1').val();
		var postLevel2 = $('#editGroup\\.postLevel2').val();
		var postLevel3 = $('#editGroup\\.postLevel3').val();		
		var errMsg = "";
		if (null == postLevel1 || 0 == postLevel1.length){
			errMsg = errMsg + "繳費金額100元以下是必要欄位<br/>";
		}else if (isNaN(postLevel1)){
			errMsg = errMsg + "繳費金額100元以下格式錯誤<br/>";
		}
		if (null == postLevel2 || 0 == postLevel2.length){
			errMsg = errMsg + "繳費金額逾100元至1000元是必要欄位<br/>";
		}else if (isNaN(postLevel2)){
			errMsg = errMsg + "繳費金額逾100元至1000元格式錯誤<br/>";
		}
		if (null == postLevel3 || 0 == postLevel3.length){
			errMsg = errMsg + "繳費金額逾1000元是必要欄位<br/>";
		}else if (isNaN(postLevel3)){
			errMsg = errMsg + "繳費金額逾1000元格式錯誤<br/>";
		}
		if (0 != errMsg.length){
			$("#ajaxErrorMessageDiv").html(errMsg);
			$("#ajaxErrorMessageDiv" ).dialog({  
				title:'請修正下列錯誤' 
				,width: 400
				, resizable: false
				, modal: true
				, buttons: {
					Ok: function() {
						$( this ).dialog( "close" );
					}
				}
			});
			return false;
		}
		$('#hidden\\.editGroup\\.groupPk').val(groupPk);
		$('#hidden\\.editGroup\\.postLevel1').val(postLevel1);
		$('#hidden\\.editGroup\\.postLevel2').val(postLevel2);
		$('#hidden\\.editGroup\\.postLevel3').val(postLevel3);
		doSaveGroupAppPost();
	});	
	
});
</script>
<div id="editGroupFormDiv">
	<stripes:form id="editGroupForm" name="editGroupForm" 
		beanclass="com.feib.soeasy.action.Soez9008ActionBean" method="post" onsubmit="javascript: return false;">
		<table id="listTable" class="realAccountList">
		<thead>
			<tr>
				<th align="center">繳費金額100元以下</th>
				<th align="center">繳費金額逾100元至1000元</th>
				<th align="center">繳費金額逾1000元</th>
			</tr>
			<tr><stripes:hidden id="editGroup.groupPk" name="editGroup.groupPk" />			
			<td align="center"><stripes:text id="editGroup.postLevel1" name="editGroup.postLevel1" size="1" maxlength="2"/>
			</td>
			<td align="center"><stripes:text id="editGroup.postLevel2" name="editGroup.postLevel2" size="1" maxlength="2"/>
			</td>
			<td align="center"><stripes:text id="editGroup.postLevel3" name="editGroup.postLevel3" size="1" maxlength="2"/>
			</td>
			</tr>
			<tr>
			<td colspan="8" class="queryFunction" align="center">
				<input type="button" id="doSaveGroupBtn" value="確認" />
				<input type="button" value="離開" id="cancelEditGroupBtn"/>
			</td>
			</tr>	
		</thead>
		</table>
		</stripes:form>
</div>

<div id="editGroupHiddenDiv" style="display: none;">
<stripes:form id="editGroupHiddenForm" name="editGroupHiddenForm" 
	beanclass="com.feib.soeasy.action.Soez9008ActionBean" method="post" onsubmit="javascript: return false;">
	<input id="hidden.editGroup.postLevel1" name="editGroup.postLevel1" />
	<input id="hidden.editGroup.postLevel2" name="editGroup.postLevel2" />
	<input id="hidden.editGroup.postLevel3" name="editGroup.postLevel3" />
	<input type="hidden" id="doAjaxMethod" name="doAjaxSaveGroup" />
</stripes:form>
</div>

